﻿using System.Diagnostics;
using System.IO;

namespace HmLab.Func2;

internal class LbPrepareYearOut {

  /// <summary>
  /// PrepareOut
  /// <see cref="Haimen.Func2.YearResultMaker"/>
  /// </summary>
  public void Run() {
    string devDir = @"E:\work_etc\nina\2023haimen2\workshop_cslab\输O入func2b\输O入\dev";
    string resDir = @"E:\work_etc\nina\2023haimen2\workshop_cs\haimen\resources\func2";
    string outDir = @"E:\work_etc\nina\2023haimen2\workshop_cslab\输Q出f2";

    const string result = "year1_zong.xlsx";
    var ResolveTpl = () => {
      string devTpl = Path.Join(devDir, result);
      if (File.Exists(devTpl)) {
        System.Console.WriteLine($"检测到dev：{devTpl}");
        return devTpl;
      }
      string resTpl = Path.Join(resDir, result);
      Debug.Assert(File.Exists(resTpl));
      return resTpl;
    };

    string outPath = Path.Join(outDir, "年汇总表.xlsx");
    string tplPath = ResolveTpl();
    File.Copy(tplPath, outPath, overwrite: true);
  }
}
